From 618dbf4a47381efa3f84fea66c2b80c376022fb1 Mon Sep 17 00:00:00 2001 From: Alex Williamson Date: Mon, 21 May 2007 10:09:33 -0600 Subject: [PATCH] [IA64] memmap: add IA64_DOM0VP_fpswa_revision hypercall For ia64 domain builder memmap support Signed-off-by: Isaku Yamahata --- .../arch/ia64/xen/xcom_hcall.c | 7 ++++ .../arch/ia64/xen/xcom_mini.c | 16 +++++++++ .../arch/ia64/xen/xcom_privcmd.c | 34 +++++++++++++++++++ .../include/asm-ia64/hypercall.h | 9 +++++ xen/arch/ia64/xen/dom0_ops.c | 16 +++++++++ xen/include/public/arch-ia64.h | 3 ++ 6 files changed, 85 insertions(+) diff --git a/linux-2.6-xen-sparse/arch/ia64/xen/xcom_hcall.c b/linux-2.6-xen-sparse/arch/ia64/xen/xcom_hcall.c index 4c90b5b01e..694744fc0c 100644 --- a/linux-2.6-xen-sparse/arch/ia64/xen/xcom_hcall.c +++ b/linux-2.6-xen-sparse/arch/ia64/xen/xcom_hcall.c @@ -395,3 +395,10 @@ xencomm_hypercall_vcpu_op(int cmd, int cpu, void *arg) return xencomm_arch_hypercall_vcpu_op(cmd, cpu, xencomm_create_inline(arg)); } + +int +xencomm_hypercall_fpswa_revision(unsigned int *revision) +{ + return xencomm_arch_hypercall_fpswa_revision( + xencomm_create_inline(revision)); +} diff --git a/linux-2.6-xen-sparse/arch/ia64/xen/xcom_mini.c b/linux-2.6-xen-sparse/arch/ia64/xen/xcom_mini.c index 3c0baff1f0..b905c97f20 100644 --- a/linux-2.6-xen-sparse/arch/ia64/xen/xcom_mini.c +++ b/linux-2.6-xen-sparse/arch/ia64/xen/xcom_mini.c @@ -467,3 +467,19 @@ xencomm_mini_hypercall_sched_op(int cmd, void *arg) return xencomm_arch_hypercall_sched_op(cmd, desc); } EXPORT_SYMBOL_GPL(xencomm_mini_hypercall_sched_op); + +int +xencomm_mini_hypercall_fpswa_revision(unsigned int *revision) +{ + int nbr_area = 2; + struct xencomm_mini xc_area[2]; + struct xencomm_handle *desc; + int rc; + + rc = xencomm_create_mini(xc_area, &nbr_area, + revision, sizeof(*revision), &desc); + if (rc) + return rc; + return xencomm_arch_hypercall_fpswa_revision(desc); +} +EXPORT_SYMBOL_GPL(xencomm_mini_hypercall_fpswa_revision); diff --git a/linux-2.6-xen-sparse/arch/ia64/xen/xcom_privcmd.c b/linux-2.6-xen-sparse/arch/ia64/xen/xcom_privcmd.c index 7c67373ccc..2e92b54917 100644 --- a/linux-2.6-xen-sparse/arch/ia64/xen/xcom_privcmd.c +++ b/linux-2.6-xen-sparse/arch/ia64/xen/xcom_privcmd.c @@ -643,6 +643,38 @@ xencomm_privcmd_sched_op(privcmd_hypercall_t *hypercall) return ret; } +static int +xencomm_privcmd_ia64_dom0vp_op(privcmd_hypercall_t *hypercall) +{ + int cmd = hypercall->arg[0]; + int ret; + + switch (cmd) { + case IA64_DOM0VP_fpswa_revision: { + unsigned int revision; + unsigned int __user *revision_user = + (unsigned int* __user)hypercall->arg[1]; + struct xencomm_handle *desc; + ret = xencomm_create(&revision, sizeof(revision), + &desc, GFP_KERNEL); + if (ret) + break; + ret = xencomm_arch_hypercall_fpswa_revision(desc); + xencomm_free(desc); + if (ret) + break; + if (copy_to_user(revision_user, &revision, sizeof(revision))) + ret = -EFAULT; + break; + } + default: + printk("%s: unknown IA64 DOM0VP op %d\n", __func__, cmd); + ret = -EINVAL; + break; + } + return ret; +} + int privcmd_hypercall(privcmd_hypercall_t *hypercall) { @@ -665,6 +697,8 @@ privcmd_hypercall(privcmd_hypercall_t *hypercall) return xencomm_privcmd_hvm_op(hypercall); case __HYPERVISOR_sched_op: return xencomm_privcmd_sched_op(hypercall); + case __HYPERVISOR_ia64_dom0vp_op: + return xencomm_privcmd_ia64_dom0vp_op(hypercall); default: printk("%s: unknown hcall (%ld)\n", __func__, hypercall->op); return -ENOSYS; diff --git a/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h b/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h index b8f393a8c8..e4e31a8832 100644 --- a/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h +++ b/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h @@ -382,6 +382,13 @@ xencomm_arch_hypercall_perfmon_op(unsigned long cmd, IA64_DOM0VP_perfmon, cmd, arg, count); } +static inline int +xencomm_arch_hypercall_fpswa_revision(struct xencomm_handle *arg) +{ + return _hypercall2(int, ia64_dom0vp_op, + IA64_DOM0VP_fpswa_revision, arg); +} + // for balloon driver #define HYPERVISOR_update_va_mapping(va, new_val, flags) (0) @@ -397,6 +404,7 @@ xencomm_arch_hypercall_perfmon_op(unsigned long cmd, #define HYPERVISOR_memory_op xencomm_mini_hypercall_memory_op #define HYPERVISOR_xenoprof_op xencomm_mini_hypercall_xenoprof_op #define HYPERVISOR_perfmon_op xencomm_mini_hypercall_perfmon_op +#define HYPERVISOR_fpswa_revision xencomm_mini_hypercall_fpswa_revision #else #define HYPERVISOR_sched_op xencomm_hypercall_sched_op #define HYPERVISOR_event_channel_op xencomm_hypercall_event_channel_op @@ -408,6 +416,7 @@ xencomm_arch_hypercall_perfmon_op(unsigned long cmd, #define HYPERVISOR_memory_op xencomm_hypercall_memory_op #define HYPERVISOR_xenoprof_op xencomm_hypercall_xenoprof_op #define HYPERVISOR_perfmon_op xencomm_hypercall_perfmon_op +#define HYPERVISOR_fpswa_revision xencomm_hypercall_fpswa_revision #endif #define HYPERVISOR_suspend xencomm_hypercall_suspend diff --git a/xen/arch/ia64/xen/dom0_ops.c b/xen/arch/ia64/xen/dom0_ops.c index 704876fb58..a48969cf59 100644 --- a/xen/arch/ia64/xen/dom0_ops.c +++ b/xen/arch/ia64/xen/dom0_ops.c @@ -352,6 +352,16 @@ dom0vp_ioremap(struct domain *d, unsigned long mpaddr, unsigned long size) ASSIGN_writable | ASSIGN_nocache); } +static unsigned long +dom0vp_fpswa_revision(XEN_GUEST_HANDLE(uint) revision) +{ + if (fpswa_interface == NULL) + return -ENOSYS; + if (copy_to_guest(revision, &fpswa_interface->revision, 1)) + return -EFAULT; + return 0; +} + unsigned long do_dom0vp_op(unsigned long cmd, unsigned long arg0, unsigned long arg1, unsigned long arg2, @@ -402,6 +412,12 @@ do_dom0vp_op(unsigned long cmd, ret = do_perfmon_op(arg0, hnd, arg2); break; } + case IA64_DOM0VP_fpswa_revision: { + XEN_GUEST_HANDLE(uint) hnd; + set_xen_guest_handle(hnd, (uint*)arg0); + ret = dom0vp_fpswa_revision(hnd); + break; + } default: ret = -1; printk("unknown dom0_vp_op 0x%lx\n", cmd); diff --git a/xen/include/public/arch-ia64.h b/xen/include/public/arch-ia64.h index ac0bae0a7b..390d74f12f 100644 --- a/xen/include/public/arch-ia64.h +++ b/xen/include/public/arch-ia64.h @@ -504,6 +504,9 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t); /* gmfn version of IA64_DOM0VP_add_physmap */ #define IA64_DOM0VP_add_physmap_with_gmfn 9 +/* get fpswa revision */ +#define IA64_DOM0VP_fpswa_revision 10 + // flags for page assignement to pseudo physical address space #define _ASSIGN_readonly 0 #define ASSIGN_readonly (1UL << _ASSIGN_readonly) -- 2.30.2